public class Person implements Cloneable {
    private Address address;

    

    public Person(Address address) {
        this.address = address;
    }



    @Override
    protected Person clone() {
        try {
            Person person = (Person) super.clone();
            // 深拷贝
            person.setAddress(person.getAddress().clone());
            return person;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError();
        }
    }



    public Address getAddress() {
        return address;
    }



    public void setAddress(Address address) {
        this.address = address;
    }
}